package com.smart.community.admin.common.qo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NonNull;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import javax.validation.groups.Default;

import static com.smart.community.admin.common.constants.SysUserConstants.UserValidation.*;

/**
 * @author zhangwei
 */
@Data
@Validated
@ApiModel("用户请求参数")
public class SysUserQo {
    @ApiModelProperty("用户ID")
    private int userId;

    @ApiModelProperty("关键字")
    private String key;
    @ApiModelProperty("用户类型ID")
    private Integer userTypeId;
    @ApiModelProperty("用户的状态")
    private int delStatus;

    @ApiModelProperty("用户名")
    @NonNull
    @Pattern(groups = {UserLogin.class}, regexp = USERNAME_VALID_REGEXP_PATTERN, message = USERNAME_VALID_MESSAGE)
    private String username;
    @NonNull
    @ApiModelProperty("密码")
    @Pattern(groups = {UserLogin.class}, regexp = PASSWORD_VALID_REGEXP_PATTERN, message = PASSWORD_VALID_MESSAGE)
    private String password;

    @ApiModelProperty("手机号")
    @Pattern(regexp = PHONE_VALID_REGEXP_PATTERN, message = PHONE_VALID_MESSAGE, groups = {PhoneLogin.class})
    private String phone;
    @ApiModelProperty("验证码")
    @Size(min = 6, max = 6, message = CODE_VALID_MESSAGE, groups = {PhoneLogin.class})
    private String code;

    public interface UserLogin extends Default {

    }

    public interface PhoneLogin extends Default {

    }
}
